<template>
  <div class="indexPage">
    <IndexHead :Data="headData">
    </IndexHead>

    <PicShow :getData="picShowData"></PicShow>

    <CompanyInfo :info="companyInfo"></CompanyInfo>

    <ProjectsTemp :imgsUrl="foreProjectShow"></ProjectsTemp>
  </div>
</template>

<script>
import { getCompanyInfo, getForeProject } from '@/request/api'

import IndexHead from './IndexHead'
import PicShow from './Picshow'
import CompanyInfo from './CompanyInfo'
import ProjectsTemp from './ProjectsTemp'

export default {
  name: 'indexPage',
  components: {
    IndexHead,
    PicShow,
    CompanyInfo,
    ProjectsTemp
  },
  data () {
    return {
      headData: {
        icon: null,
        title: null
      },
      picShowData: {
        imgUrl: null,
        word: null
      },
      companyInfo: null,
      foreProjectShow: null
    }
  },
  created () {},
  mounted () {
    // 获取公司信息，主要获取公司图标
    getCompanyInfo().then(res => {
      this.headData.icon = 'http://backmanage.yuxjt.com/' + res.company_icon.url_img
      this.headData.title = res.company_indexTitle
      this.picShowData.imgUrl = 'http://backmanage.yuxjt.com/' + res.company_indeximg.url_img
      this.picShowData.word = res.company_indexword
      this.companyInfo = res.company_info
    })
    // 获取四个工程
    getForeProject().then(res => {
      this.foreProjectShow = res.slice(0, 4)
    })
  },
  methods: {

  }
}
</script>

<style scoped lang="scss">
  .indexPage {

  }
</style>
